package com.wh.disruptor;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.lmax.disruptor.EventFactory;
import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.dsl.Disruptor;
/**
 * 
 *  Class Name: LongEventTest.java
 *  Description: 博客地址：http://www.cnblogs.com/haiq/p/4112689.html
 *  @author wanghao  DateTime 2017年3月2日 下午5:51:22 
 *  @company hongbo
 *  @email 1228675455@qq.com
 */
public class LongEventTest {

	public static void main(String[] args) {
		EventFactory<LongEvent> eventFactory = new LongEventFactory();
		ExecutorService executorService = Executors.newCachedThreadPool();
		int ringBufferSize = 1024 * 1024; // RingBuffer 大小，必须是 2 的 N 次方；
		Disruptor<LongEvent> disruptor = new Disruptor<>(eventFactory, ringBufferSize, executorService);
		
		EventHandler<LongEvent> eventHandler = new LongEventHandler();
		disruptor.handleEventsWith(eventHandler);
		
		disruptor.start();
		
		
	}
}
